Can the Flash CS4 [embed] tag be made to export assets to frame 2 rather than frame 1?
Posted
by Tim Knauf
on Stack Overflow
See other posts from Stack Overflow
or by Tim Knauf
Published on 2010-01-10T23:12:55Z
Indexed on
2010/03/21
18:01 UTC
Read the original article
Hit count: 406
We're working on a Flash CS4 project where the main .fla file has ballooned in size and 'Publish' is taking forever. I suspect a large amount of the size (and at least some of the compile time) is due to the quantity of audio symbols in the library.
I would love to remove this unnecessary bloat from the .fla file. I've experimented with removing an audio symbol from the library and using the [embed]
metadata tag instead, like so:
[Embed(source="audio/music/EndOfLevelDitty.mp3")]
public var EndOfLevelDitty:Class
The resulting published file works perfectly, but there is a problem. Our game uses a preloader on the first frame of the timeline, so all other classes need to be exported in frame 2 (as set in Publish Settings > ActionScript 3.0 Settings). So a size report normally begins like this:
Frame # Frame Bytes Total Bytes Scene ------- ----------- ----------- ---------------- 1 284515 284515 Scene 1 2 5485305 5769820 (AS 3.0 Classes Export Frame)
However, if I use an [embed]
tag on a small sound, my size report is now:
Frame # Frame Bytes Total Bytes Scene ------- ----------- ----------- ---------------- 1 363320 363320 Scene 1 2 5407240 5770560 (AS 3.0 Classes Export Frame)
As you can see, the embedded sound has been exported into frame 1 rather than frame 2. If I were to embed all sounds in this manner, the size of frame 1 would grow to be huge, and users would be looking at a white screen for ages before the preloader frame even loaded.
So my question is this: can I use an [embed]
tag but have the embedded asset export in frame 2 instead of frame 1?
Project constraints:
- Our team composition means we can't change to pure Flex at this stage.
- The compiled .swf needs to be 'all in one', so we can't split the preloader into a separate file, and we can't access external resources.
Edit: I'd also settle for having the audio in an embedded library SWC, but there seems to be no way to make that embed in frame 2 either; it always ends up in frame 1.
© Stack Overflow or respective owner